<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>亚马逊 - 登录</title>
    <link href="${pageContext.request.contextPath}/css/index.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/css/adv.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-2.1.0.js"></script>
    <%--<script src="${pageContext.request.contextPath}/scripts/adv.js" type="text/javascript"></script>--%>
    <%--   <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function.js"></script>
       <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/index.js"></script>--%>

    <script>
        var $username, $pwd, $code, $login, $img;
        $(function () {
            $username = $("#username");
            $pwd = $("#passWord");
            $code = $("#ycode");
            $login = $("#login");
            $img = $("#veryCode");
            $login.click(function () {
                $.post("${pageContext.request.contextPath}/lr",{
					"uname":$username.val(),
					"pwd":$pwd.val(),
					"code":$code.val(),
					"codes":$img.val(),
					"param":"login"
				},function (data) {
					console.log(data.success);
					if (data.success == true) {
						window.location="${pageContext.request.contextPath}/news?param=showall";
					}else{
						window.location="${pageContext.request.contextPath}/lr?param=login";
					}
				},"json");
            })
        })
    </script>
</head>
<body>
<%@ include file="index_top.jsp" %>
<div id="register" class="wrap">
    <div class="shadow">
        <em class="corner lb"></em>
        <em class="corner rt"></em>
        <div class="box">
            <h1>欢迎回到亚马逊</h1>
            <form id="loginForm" onsubmit="return loginCheck()">
                <table>
                    <tr>
                        <td class="field">用户名：</td>
                        <td><input class="text" type="text" name="userName" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="username"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">登录密码：</td>
                        <td><input class="text" type="password" id="passWord" name="passWord" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);"/><a href="retrieve_password.jsp">忘记密码</a></td>

                    </tr>
                    <tr>
                        <td class="field">验证码：</td>
                        <td><input class="text verycode" type="text" name="veryCode" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" maxlength="4" id="ycode"/><img id="veryCode"
                                                                                            src="${pageContext.request.contextPath}/validateCode"/><span
                                id="Code"></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><label class="ui-green"><input type="button" name="submit" value="立即登录" id="login"/></label>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2018 上海海文 All Rights Reserved
</div>
</body>
</html>
